import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    ruleForm:null,
  },
  getters: {
    getRuleForm:(state => {
      if(!state.ruleForm){
        state.ruleForm = JSON.parse(window.localStorage.getItem("ruleForm"));
      }
      return state.ruleForm?state.ruleForm:{};
    })

  },
  mutations: {
    setRuleForm:((state, ruleForm) => {
      state.ruleForm=ruleForm;
      window.localStorage.setItem("ruleForm",JSON.stringify(ruleForm));
    })

  },
  actions: {
  },
  modules: {
  }
})
